
<!DOCTYPE HTML>
<html lang="zh-hans" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>下载 & 重命名 · video-coding</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        <meta name="author" content="Avanti">
        
        
    
    
    <link rel="stylesheet" href="../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-splitter/splitter.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-disqus/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-donate/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-search-plus/search.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-advanced-emoji/emoji-website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-emphasize/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-mermaid-gb3/mermaid/mermaid.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-tbfed-pagefooter/footer.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-anchors/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-terminal/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
        <link rel="stylesheet" href="../styles/website.css">
        
    


    

        
    
    
    
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="encoding-upload.html" />
    
    

    
    <link rel="stylesheet" href="../gitbook/gitbook-plugin-chart/c3/c3.min.css">
    <script src="../gitbook/gitbook-plugin-chart/c3/d3.min.js"></script>
    <script src="../gitbook/gitbook-plugin-chart/c3/c3.min.js"></script>
    

    <script src="../gitbook/gitbook-plugin-graph/d3.min.js"></script>
    <script src="../gitbook/gitbook-plugin-graph/function-plot.js"></script>    

    <style>
    @media only screen and (max-width: 640px) {
        .book-header .hidden-mobile {
            display: none;
        }
    }
    </style>
    <script>
        window["gitbook-plugin-github-buttons"] = {};
    </script>

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="输入并搜索" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../">
            
                <a href="../">
            
                    
                    简介
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" >
            
                <span>
            
                    
                    绯红
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter active" data-level="1.2.1" data-path="download-rename.html">
            
                <a href="download-rename.html">
            
                    
                    下载 & 重命名
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="encoding-upload.html">
            
                <a href="encoding-upload.html">
            
                    
                    压制 & 上传
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            本书使用 GitBook 发布
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href=".." >下载 & 重命名</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div class="search-plus" id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <p>&#x3000;&#x3000;&#x67E5;&#x8BE2;&#x7F51;&#x76D8;&#x73B0;&#x6709;&#x7684;ts&#x6587;&#x4EF6;&#xFF1A;</p>
<pre><code>$ baidupcs ls /&#x7EEF;&#x7EA2;/&#x6668;&#x95F4;&#x539F;&#x6863;&#x7B49;&#x591A;&#x4E2A;&#x6587;&#x4EF6; | sed -n &apos;s/.*&#xFF2E;&#xFF28;&#xFF2B;\(.*\)ts.*/&#xFF2E;&#xFF28;&#xFF2B;\1ts/p&apos;         
&#xFF2E;&#xFF28;&#xFF2B;&#xFF22;&#xFF33;&#x30D7;&#x30EC;&#x30DF;&#x30A2;&#x30E0; &#x9023;&#x7D9A;&#x30C6;&#x30EC;&#x30D3;&#x5C0F;&#x8AAC; &#x30B9;&#x30AB;&#x30FC;&#x30EC;&#x30C3;&#x30C8;&#xFF08;&#xFF13;&#xFF19;&#xFF09;&#x300C;&#x5F1F;&#x5B50;&#x306B;&#x3057;&#x3066;&#x304F;&#x3060;&#x3055;&#x3044;&#xFF01;&#x300D;[&#x89E3;][&#x5B57;] 20191113_0730.ts
&#xFF2E;&#xFF28;&#xFF2B;&#xFF22;&#xFF33;&#x30D7;&#x30EC;&#x30DF;&#x30A2;&#x30E0; &#x9023;&#x7D9A;&#x30C6;&#x30EC;&#x30D3;&#x5C0F;&#x8AAC; &#x30B9;&#x30AB;&#x30FC;&#x30EC;&#x30C3;&#x30C8;&#xFF08;&#xFF14;&#xFF10;&#xFF09;&#x300C;&#x5F1F;&#x5B50;&#x306B;&#x3057;&#x3066;&#x304F;&#x3060;&#x3055;&#x3044;&#xFF01;&#x300D;[&#x89E3;][&#x5B57;] 20191114_0730.ts
</code></pre><p>&#x8FD9;&#x4E2A;&#x4F8B;&#x5B50;&#x4E2D;&#x7F51;&#x76D8;&#x5B58;&#x653E;&#x7740;&#x7B2C;39&#x548C;40&#x96C6;&#x3002;</p>
<p>&#x3000;&#x3000;&#x67E5;&#x8BE2;&#x672C;&#x5730;&#x4E0B;&#x8F7D;&#x7684;ts&#x6587;&#x4EF6;&#xFF1A;</p>
<pre><code>$ ls ~/Videos/&#x7EEF;&#x7EA2;/&#x539F;&#x6863;
190920 &#x3082;&#x3046;&#x3059;&#x3050;&#xFF01;&#x9023;&#x7D9A;&#x30C6;&#x30EC;&#x30D3;&#x5C0F;&#x8AAC;&#x300C;&#x30B9;&#x30AB;&#x30FC;&#x30EC;&#x30C3;&#x30C8;&#x300D;.ts
190927 &#x3044;&#x3088;&#x3044;&#x3088;&#x30B9;&#x30BF;&#x30FC;&#x30C8;&#xFF01;&#x9023;&#x7D9A;&#x30C6;&#x30EC;&#x30D3;&#x5C0F;&#x8AAC;&#x300C;&#x30B9;&#x30AB;&#x30FC;&#x30EC;&#x30C3;&#x30C8;&#x300D;&#x30B9;&#x30DA;&#x30B7;&#x30E3;&#x30EB;_Cut.ts
190930-ep1.ts
191001-ep2.ts
&#x2026;&#x2026;
191112-ep38.ts
191113-ep39.ts
</code></pre><p>&#x6CE8;&#x610F;&#x672C;&#x5730;&#x6587;&#x4EF6;&#x8FDB;&#x884C;&#x4E86;&#x91CD;&#x547D;&#x540D;&#xFF0C;&#x8FD9;&#x662F;&#x4E3A;&#x4E86;&#x907F;&#x514D;&#x65E5;&#x6587;&#x7ED9;&#x540E;&#x7EED;&#x538B;&#x5236;&#x5E26;&#x6765;&#x9EBB;&#x70E6;&#x3002;</p>
<p>&#x3000;&#x3000;&#x4E0B;&#x8F7D;&#x6CA1;&#x6709;&#x4E0B;&#x8FC7;&#x7684;ts&#x6587;&#x4EF6;&#xFF0C;&#x811A;&#x672C;&#x5982;&#x4E0B;&#xFF1A;</p>
<pre><code class="lang-shell">#!/usr/bin/env bash

SAVEIFS=$IFS
IFS=$(echo -en &quot;\n\b&quot;)

# &#x67E5;&#x8BE2;&#x7F51;&#x76D8;&#x73B0;&#x6709;&#x7684;ts&#x6587;&#x4EF6;
download_list=($(baidupcs ls /&#x7EEF;&#x7EA2;/&#x6668;&#x95F4;&#x539F;&#x6863;&#x7B49;&#x591A;&#x4E2A;&#x6587;&#x4EF6; | sed -n &apos;s/.*&#xFF2E;&#xFF28;&#xFF2B;\(.*\)ts.*/&#xFF2E;&#xFF28;&#xFF2B;\1ts/p&apos;))

# &#x67E5;&#x8BE2;&#x672C;&#x5730;&#x4E0B;&#x8F7D;&#x7684;ts&#x6587;&#x4EF6;
exist_files=$(ls ~/Videos/&#x7EEF;&#x7EA2;/&#x539F;&#x6863;)

for line in ${download_list[@]}; do # &#x4F9D;&#x6B21;&#x5904;&#x7406;&#x7F51;&#x76D8;&#x4E2D;&#x73B0;&#x6709;&#x7684;ts&#x6587;&#x4EF6;

    # &#x83B7;&#x53D6;&#x65E5;&#x671F;
    time=$(echo $line | sed -n &apos;s/.*].20\(.*\)_.*/\1/p&apos;)

    # &#x83B7;&#x53D6;&#x96C6;&#x6570;&#x5E76;&#x5904;&#x7406;&#x65E5;&#x6587;&#x6570;&#x5B57;
    ep=$(echo $line | sed &apos;s/.*&#xFF08;\([&#xFF11;&#xFF12;&#xFF13;&#xFF14;&#xFF15;&#xFF16;&#xFF17;&#xFF18;&#xFF19;&#xFF10;]*\)&#xFF09;.*/\1/g&apos;)
    ep=${ep//&#xFF10;/0}
    ep=${ep//&#xFF11;/1}
    ep=${ep//&#xFF12;/2}
    ep=${ep//&#xFF13;/3}
    ep=${ep//&#xFF14;/4}
    ep=${ep//&#xFF15;/5}
    ep=${ep//&#xFF16;/6}
    ep=${ep//&#xFF17;/7}
    ep=${ep//&#xFF18;/8}
    ep=${ep//&#xFF19;/9}

    # &#x662F;&#x5426;&#x5DF2;&#x7ECF;&#x4E0B;&#x5230;&#x672C;&#x5730;&#x4E86;?
    if [[ &quot;$exist_files&quot; =~ &quot;$time-ep$ep.ts&quot; ]]; then
        echo &#x6587;&#x4EF6; &quot;&lt; $time-ep$ep.ts &gt;&quot; &#x5DF2;&#x5B58;&#x5728;
    else
        line=${line// /\\ } # &#x7A7A;&#x683C;&#x8981;&#x52A0;&#x659C;&#x6760;&#x8F6C;&#x4E49;

        # &#x662F;&#x5426;&#x4E0B;&#x5230;&#x672C;&#x5730;&#x4E86;&#x4F46;&#x8FD8;&#x6CA1;&#x6709;&#x91CD;&#x547D;&#x540D;&#xFF1F;
        if [[ &quot;$exist_files&quot; =~ &quot;$line&quot; ]]; then
            echo &#x6587;&#x4EF6; &quot;$line&quot; &#x5DF2;&#x5B58;&#x5728;
        else
            echo &#x6587;&#x4EF6; &quot;$line&quot; &#x4E0D;&#x5B58;&#x5728; &#x5F00;&#x59CB;&#x4E0B;&#x8F7D;
            baidupcs download -saveto ~/Videos/&#x7EEF;&#x7EA2;/&#x539F;&#x6863;/ /&#x7EEF;&#x7EA2;/&#x6668;&#x95F4;&#x539F;&#x6863;&#x7B49;&#x591A;&#x4E2A;&#x6587;&#x4EF6;/$line
        fi

        # &#x4E2D;&#x62EC;&#x53F7;&#x8981;&#x52A0;&#x659C;&#x6760;&#x8F6C;&#x4E49;
        line=${line//[/\\[}
        line=${line//]/\\]}

        # &#x5C06;&#x672C;&#x5730;&#x7684;ts&#x6587;&#x4EF6;&#x91CD;&#x547D;&#x540D;
        mv ~/Videos/&#x7EEF;&#x7EA2;/&#x539F;&#x6863;/$line ~/Videos/&#x7EEF;&#x7EA2;/&#x539F;&#x6863;/$time-ep$ep.ts
    fi
done
</code></pre>
<footer class="page-footer"><span class="copyright">Copyright &#xA9; Avanti 2020 all right reserved&#xFF0C;powered by Gitbook</span><span class="footer-modification">&#x6587;&#x4EF6;&#x6700;&#x540E;&#x4FEE;&#x6539;&#x65F6;&#x95F4;&#xFF1A;
2021-06-03 11:36:54
</span></footer>
                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                
                <a href="encoding-upload.html" class="navigation navigation-next navigation-unique" aria-label="Next page: 压制 & 上传">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"下载 & 重命名","level":"1.2.1","depth":2,"next":{"title":"压制 & 上传","level":"1.2.2","depth":2,"path":"Scarlet/encoding-upload.md","ref":"Scarlet/encoding-upload.md","articles":[]},"previous":{"title":"绯红","level":"1.2","depth":1,"ref":"","articles":[{"title":"下载 & 重命名","level":"1.2.1","depth":2,"path":"Scarlet/download-rename.md","ref":"Scarlet/download-rename.md","articles":[]},{"title":"压制 & 上传","level":"1.2.2","depth":2,"path":"Scarlet/encoding-upload.md","ref":"Scarlet/encoding-upload.md","articles":[]}]},"dir":"ltr"},"config":{"plugins":["splitter","disqus","donate","github","github-buttons","copy-code-button","-lunr","-search","search-plus","advanced-emoji","emphasize","mermaid-gb3","puml","graph","chart","-sharing","sharing-plus","tbfed-pagefooter","anchors","terminal"],"root":".","styles":{"website":"styles/website.css"},"pluginsConfig":{"tbfed-pagefooter":{"copyright":"Copyright &copy Avanti 2020","modify_label":"文件最后修改时间：","modify_format":"YYYY-MM-DD HH:mm:ss"},"disqus":{"useIdentifier":false,"shortName":"video-coding"},"emphasize":{},"github":{"url":"https://github.com/Avanti1980"},"puml":{},"splitter":{},"sharing-plus":{"qq":false,"all":["facebook","google","twitter","instapaper","linkedin","pocket","stumbleupon"],"douban":false,"facebook":true,"weibo":false,"instapaper":false,"whatsapp":false,"hatenaBookmark":false,"twitter":true,"messenger":false,"line":false,"vk":false,"pocket":true,"google":false,"viber":false,"stumbleupon":false,"qzone":false,"linkedin":false},"graph":{},"donate":{"alipay":"https://raw.githubusercontent.com/Avanti1980/Notes-on-Linear-Algebra/master/img/zfb.jpg","alipayText":"支付宝","button":"赏","title":"","wechat":"https://raw.githubusercontent.com/Avanti1980/Notes-on-Linear-Algebra/master/img/wx.jpg","wechatText":"微信"},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"mermaid-gb3":{},"github-buttons":{},"copy-code-button":{},"advanced-emoji":{"embedEmojis":false},"sharing":{"qq":true,"douban":true,"facebook":true,"weibo":true,"instapaper":false,"whatsapp":false,"hatenaBookmark":false,"twitter":true,"messenger":false,"line":true,"vk":false,"pocket":false,"google":true,"viber":false,"stumbleupon":false,"qzone":true,"linkedin":true},"terminal":{"copyButtons":true,"fade":false,"style":"flat"},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"anchors":{},"chart":{"type":"c3"},"search-plus":{}},"theme":"default","author":"Avanti","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"video-coding","language":"zh-hans","output.name":"site","gitbook":"3.2.3","description":"压制视频记录"},"file":{"path":"Scarlet/download-rename.md","mtime":"2021-06-03T03:36:54.207Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2021-06-03T04:06:51.380Z"},"basePath":"..","book":{"language":""}});
        });
    </script>
</div>

        
    
    <script src="../gitbook/gitbook.js"></script>
    <script src="../gitbook/theme.js"></script>
    
        
        <script src="../gitbook/gitbook-plugin-splitter/splitter.js"></script>
        
    
        
        <script src="https://cdnjs.cloudflare.com/ajax/libs/URI.js/1.16.1/URI.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-disqus/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-donate/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-github/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-github-buttons/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-copy-code-button/toggle.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search-plus/jquery.mark.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search-plus/search.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-mermaid-gb3/book/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-sharing-plus/buttons.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-terminal/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    <script src="../gitbook/gitbook-plugin-mermaid-gb3/mermaid/mermaid.min.js"></script>

    </body>
</html>

